home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Technology Seed / August 1998 ADC Seed CD.toast / Mac OS 8.5b2 / allegro-b2-pseudo-SDK / PInterfaces / Icons.p < prev    next >
Encoding:
Text File  |  1998-07-17  |  41.9 KB  |  1,293 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Icons.p
  3.  
  4.      Contains:    Icon Utilities and Icon Services Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 8
  7.                  Release:    Allego Seed, Use with 3.1 Universal Interfaces
  8.  
  9.      Copyright:    © 1990-1998 by Apple Computer, Inc. All rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Icons;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __ICONS__}
  28. {$SETC __ICONS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC IconsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __MACTYPES__}
  35. {$I MacTypes.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __QUICKDRAW__}
  38. {$I Quickdraw.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __FILES__}
  41. {$I Files.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __CODEFRAGMENTS__}
  44. {$I CodeFragments.p}
  45. {$ENDC}
  46.  
  47.  
  48. {$PUSH}
  49. {$ALIGN MAC68K}
  50. {$LibExport+}
  51.  
  52. { The following are icons for which there are both icon suites and SICNs. }
  53. { Avoid using icon resources if possible. Use IconServices instead. }
  54.  
  55. CONST
  56.     kGenericDocumentIconResource = -4000;
  57.     kGenericStationeryIconResource = -3985;
  58.     kGenericEditionFileIconResource = -3989;
  59.     kGenericApplicationIconResource = -3996;
  60.     kGenericDeskAccessoryIconResource = -3991;
  61.     kGenericFolderIconResource    = -3999;
  62.     kPrivateFolderIconResource    = -3994;
  63.     kFloppyIconResource            = -3998;
  64.     kTrashIconResource            = -3993;
  65.     kGenericRAMDiskIconResource    = -3988;
  66.     kGenericCDROMIconResource    = -3987;
  67.  
  68. { The following are icons for which there are SICNs only. }
  69. { Avoid using icon resources if possible. Use IconServices instead. }
  70.     kDesktopIconResource        = -3992;
  71.     kOpenFolderIconResource        = -3997;
  72.     kGenericHardDiskIconResource = -3995;
  73.     kGenericFileServerIconResource = -3972;
  74.     kGenericSuitcaseIconResource = -3970;
  75.     kGenericMoverObjectIconResource = -3969;
  76.  
  77. { The following are icons for which there are icon suites only. }
  78. { Avoid using icon resources if possible. Use IconServices instead. }
  79.     kGenericPreferencesIconResource = -3971;
  80.     kGenericQueryDocumentIconResource = -16506;
  81.     kGenericExtensionIconResource = -16415;
  82.     kSystemFolderIconResource    = -3983;
  83.     kHelpIconResource            = -20271;
  84.     kAppleMenuFolderIconResource = -3982;
  85.  
  86. { Obsolete. Use named constants defined above. }
  87.     genericDocumentIconResource    = -4000;
  88.     genericStationeryIconResource = -3985;
  89.     genericEditionFileIconResource = -3989;
  90.     genericApplicationIconResource = -3996;
  91.     genericDeskAccessoryIconResource = -3991;
  92.     genericFolderIconResource    = -3999;
  93.     privateFolderIconResource    = -3994;
  94.     floppyIconResource            = -3998;
  95.     trashIconResource            = -3993;
  96.     genericRAMDiskIconResource    = -3988;
  97.     genericCDROMIconResource    = -3987;
  98.     desktopIconResource            = -3992;
  99.     openFolderIconResource        = -3997;
  100.     genericHardDiskIconResource    = -3995;
  101.     genericFileServerIconResource = -3972;
  102.     genericSuitcaseIconResource    = -3970;
  103.     genericMoverObjectIconResource = -3969;
  104.     genericPreferencesIconResource = -3971;
  105.     genericQueryDocumentIconResource = -16506;
  106.     genericExtensionIconResource = -16415;
  107.     systemFolderIconResource    = -3983;
  108.     appleMenuFolderIconResource    = -3982;
  109.  
  110. { Avoid using icon resources if possible. Use IconServices instead. }
  111.     kStartupFolderIconResource    = -3981;
  112.     kOwnedFolderIconResource    = -3980;
  113.     kDropFolderIconResource        = -3979;
  114.     kSharedFolderIconResource    = -3978;
  115.     kMountedFolderIconResource    = -3977;
  116.     kControlPanelFolderIconResource = -3976;
  117.     kPrintMonitorFolderIconResource = -3975;
  118.     kPreferencesFolderIconResource = -3974;
  119.     kExtensionsFolderIconResource = -3973;
  120.     kFontsFolderIconResource    = -3968;
  121.     kFullTrashIconResource        = -3984;
  122.  
  123. { Obsolete. Use named constants defined above. }
  124.     startupFolderIconResource    = -3981;
  125.     ownedFolderIconResource        = -3980;
  126.     dropFolderIconResource        = -3979;
  127.     sharedFolderIconResource    = -3978;
  128.     mountedFolderIconResource    = -3977;
  129.     controlPanelFolderIconResource = -3976;
  130.     printMonitorFolderIconResource = -3975;
  131.     preferencesFolderIconResource = -3974;
  132.     extensionsFolderIconResource = -3973;
  133.     fontsFolderIconResource        = -3968;
  134.     fullTrashIconResource        = -3984;
  135.  
  136.     kHuge1BitMask                = 'ich#';
  137.     kHuge4BitData                = 'ich4';
  138.     kHuge8BitData                = 'ich8';
  139.     kHuge32BitData                = 'ih32';
  140.     kHuge8BitMask                = 'h8mk';
  141.     kLarge1BitMask                = 'ICN#';
  142.     kLarge4BitData                = 'icl4';
  143.     kLarge8BitData                = 'icl8';
  144.     kLarge32BitData                = 'il32';
  145.     kLarge8BitMask                = 'l8mk';
  146.     kSmall1BitMask                = 'ics#';
  147.     kSmall4BitData                = 'ics4';
  148.     kSmall8BitData                = 'ics8';
  149.     kSmall32BitData                = 'is32';
  150.     kSmall8BitMask                = 's8mk';
  151.     kMini1BitMask                = 'icm#';
  152.     kMini4BitData                = 'icm4';
  153.     kMini8BitData                = 'icm8';
  154.  
  155. { Obsolete. Use names defined above. }
  156.     large1BitMask                = 'ICN#';
  157.     large4BitData                = 'icl4';
  158.     large8BitData                = 'icl8';
  159.     small1BitMask                = 'ics#';
  160.     small4BitData                = 'ics4';
  161.     small8BitData                = 'ics8';
  162.     mini1BitMask                = 'icm#';
  163.     mini4BitData                = 'icm4';
  164.     mini8BitData                = 'icm8';
  165.  
  166. { Alignment type values. }
  167.     kAlignNone                    = $00;
  168.     kAlignVerticalCenter        = $01;
  169.     kAlignTop                    = $02;
  170.     kAlignBottom                = $03;
  171.     kAlignHorizontalCenter        = $04;
  172.     kAlignAbsoluteCenter        = $05;
  173.     kAlignCenterTop                = $06;
  174.     kAlignCenterBottom            = $07;
  175.     kAlignLeft                    = $08;
  176.     kAlignCenterLeft            = $09;
  177.     kAlignTopLeft                = $0A;
  178.     kAlignBottomLeft            = $0B;
  179.     kAlignRight                    = $0C;
  180.     kAlignCenterRight            = $0D;
  181.     kAlignTopRight                = $0E;
  182.     kAlignBottomRight            = $0F;
  183.  
  184. { Obsolete. Use names defined above. }
  185.     atNone                        = $00;
  186.     atVerticalCenter            = $01;
  187.     atTop                        = $02;
  188.     atBottom                    = $03;
  189.     atHorizontalCenter            = $04;
  190.     atAbsoluteCenter            = $05;
  191.     atCenterTop                    = $06;
  192.     atCenterBottom                = $07;
  193.     atLeft                        = $08;
  194.     atCenterLeft                = $09;
  195.     atTopLeft                    = $0A;
  196.     atBottomLeft                = $0B;
  197.     atRight                        = $0C;
  198.     atCenterRight                = $0D;
  199.     atTopRight                    = $0E;
  200.     atBottomRight                = $0F;
  201.  
  202.  
  203. TYPE
  204.     IconAlignmentType                    = SInt16;
  205. { Transform type values. }
  206.  
  207. CONST
  208.     kTransformNone                = $00;
  209.     kTransformDisabled            = $01;
  210.     kTransformOffline            = $02;
  211.     kTransformOpen                = $03;
  212.     kTransformLabel1            = $0100;
  213.     kTransformLabel2            = $0200;
  214.     kTransformLabel3            = $0300;
  215.     kTransformLabel4            = $0400;
  216.     kTransformLabel5            = $0500;
  217.     kTransformLabel6            = $0600;
  218.     kTransformLabel7            = $0700;
  219.     kTransformSelected            = $4000;
  220.     kTransformSelectedDisabled    = $4001;
  221.     kTransformSelectedOffline    = $4002;
  222.     kTransformSelectedOpen        = $4003;
  223.  
  224. { Obsolete. Use names defined above. }
  225.     ttNone                        = $00;
  226.     ttDisabled                    = $01;
  227.     ttOffline                    = $02;
  228.     ttOpen                        = $03;
  229.     ttLabel1                    = $0100;
  230.     ttLabel2                    = $0200;
  231.     ttLabel3                    = $0300;
  232.     ttLabel4                    = $0400;
  233.     ttLabel5                    = $0500;
  234.     ttLabel6                    = $0600;
  235.     ttLabel7                    = $0700;
  236.     ttSelected                    = $4000;
  237.     ttSelectedDisabled            = $4001;
  238.     ttSelectedOffline            = $4002;
  239.     ttSelectedOpen                = $4003;
  240.  
  241.  
  242. TYPE
  243.     IconTransformType                    = SInt16;
  244. { Selector mask values. }
  245.  
  246. CONST
  247.     kSelectorLarge1Bit            = $00000001;
  248.     kSelectorLarge4Bit            = $00000002;
  249.     kSelectorLarge8Bit            = $00000004;
  250.     kSelectorLarge32Bit            = $00000008;
  251.     kSelectorLarge8BitMask        = $00000010;
  252.     kSelectorSmall1Bit            = $00000100;
  253.     kSelectorSmall4Bit            = $00000200;
  254.     kSelectorSmall8Bit            = $00000400;
  255.     kSelectorSmall32Bit            = $00000800;
  256.     kSelectorSmall8BitMask        = $00001000;
  257.     kSelectorMini1Bit            = $00010000;
  258.     kSelectorMini4Bit            = $00020000;
  259.     kSelectorMini8Bit            = $00040000;
  260.     kSelectorHuge1Bit            = $01000000;
  261.     kSelectorHuge4Bit            = $02000000;
  262.     kSelectorHuge8Bit            = $04000000;
  263.     kSelectorHuge32Bit            = $08000000;
  264.     kSelectorHuge8BitMask        = $10000000;
  265.     kSelectorAllLargeData        = $000000FF;
  266.     kSelectorAllSmallData        = $0000FF00;
  267.     kSelectorAllMiniData        = $00FF0000;
  268.     kSelectorAllHugeData        = $FF000000;
  269.     kSelectorAll1BitData        = $01010101;
  270.     kSelectorAll4BitData        = $02020202;
  271.     kSelectorAll8BitData        = $04040404;
  272.     kSelectorAll32BitData        = $08000808;
  273.     kSelectorAllAvailableData    = $FFFFFFFF;
  274.  
  275.  
  276. { Obsolete. Use names defined above. }
  277.     svLarge1Bit                    = $00000001;
  278.     svLarge4Bit                    = $00000002;
  279.     svLarge8Bit                    = $00000004;
  280.     svSmall1Bit                    = $00000100;
  281.     svSmall4Bit                    = $00000200;
  282.     svSmall8Bit                    = $00000400;
  283.     svMini1Bit                    = $00010000;
  284.     svMini4Bit                    = $00020000;
  285.     svMini8Bit                    = $00040000;
  286.     svAllLargeData                = $000000FF;
  287.     svAllSmallData                = $0000FF00;
  288.     svAllMiniData                = $00FF0000;
  289.     svAll1BitData                = $01010101;
  290.     svAll4BitData                = $02020202;
  291.     svAll8BitData                = $04040404;
  292.     svAllAvailableData            = $FFFFFFFF;
  293.  
  294.  
  295. TYPE
  296.     IconSelectorValue                    = UInt32;
  297. {$IFC TYPED_FUNCTION_POINTERS}
  298.     IconActionProcPtr = FUNCTION(theType: ResType; VAR theIcon: Handle; yourDataPtr: UNIV Ptr): OSErr;
  299. {$ELSEC}
  300.     IconActionProcPtr = ProcPtr;
  301. {$ENDC}
  302.  
  303.     IconActionUPP = UniversalProcPtr;
  304.  
  305. CONST
  306.     uppIconActionProcInfo = $00000FE0;
  307.  
  308. FUNCTION NewIconActionProc(userRoutine: IconActionProcPtr): IconActionUPP;
  309.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  310.     INLINE $2E9F;
  311.     {$ENDC}
  312.  
  313. FUNCTION CallIconActionProc(theType: ResType; VAR theIcon: Handle; yourDataPtr: UNIV Ptr; userRoutine: IconActionUPP): OSErr;
  314.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  315.     INLINE $205F, $4E90;
  316.     {$ENDC}
  317.  
  318. TYPE
  319.     IconAction                            = IconActionProcPtr;
  320. {$IFC TYPED_FUNCTION_POINTERS}
  321.     IconGetterProcPtr = FUNCTION(theType: ResType; yourDataPtr: UNIV Ptr): Handle;
  322. {$ELSEC}
  323.     IconGetterProcPtr = ProcPtr;
  324. {$ENDC}
  325.  
  326.     IconGetterUPP = UniversalProcPtr;
  327.  
  328. CONST
  329.     uppIconGetterProcInfo = $000003F0;
  330.  
  331. FUNCTION NewIconGetterProc(userRoutine: IconGetterProcPtr): IconGetterUPP;
  332.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  333.     INLINE $2E9F;
  334.     {$ENDC}
  335.  
  336. FUNCTION CallIconGetterProc(theType: ResType; yourDataPtr: UNIV Ptr; userRoutine: IconGetterUPP): Handle;
  337.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  338.     INLINE $205F, $4E90;
  339.     {$ENDC}
  340.  
  341. TYPE
  342.     IconGetter                            = IconGetterProcPtr;
  343. {$IFC NOT OLDROUTINELOCATIONS }
  344.     CIconPtr = ^CIcon;
  345.     CIcon = RECORD
  346.         iconPMap:                PixMap;                                    { the icon's pixMap }
  347.         iconMask:                BitMap;                                    { the icon's mask }
  348.         iconBMap:                BitMap;                                    { the icon's bitMap }
  349.         iconData:                Handle;                                    { the icon's data }
  350.         iconMaskData:            ARRAY [0..0] OF SInt16;                    { icon's mask and BitMap data }
  351.     END;
  352.  
  353.     CIconHandle                            = ^CIconPtr;
  354. FUNCTION GetCIcon(iconID: SInt16): CIconHandle;
  355.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  356.     INLINE $AA1E;
  357.     {$ENDC}
  358. PROCEDURE PlotCIcon({CONST}VAR theRect: Rect; theIcon: CIconHandle);
  359.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  360.     INLINE $AA1F;
  361.     {$ENDC}
  362. PROCEDURE DisposeCIcon(theIcon: CIconHandle);
  363.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  364.     INLINE $AA25;
  365.     {$ENDC}
  366. {$ENDC}
  367.  
  368. FUNCTION GetIcon(iconID: SInt16): Handle;
  369.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  370.     INLINE $A9BB;
  371.     {$ENDC}
  372. PROCEDURE PlotIcon({CONST}VAR theRect: Rect; theIcon: Handle);
  373.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  374.     INLINE $A94B;
  375.     {$ENDC}
  376.  
  377.  
  378. {
  379.     Note:    IconSuiteRef and IconCacheRef should be an abstract types, 
  380.             but too much source code already relies on them being of type Handle.
  381. }
  382.  
  383. TYPE
  384.     IconSuiteRef                        = Handle;
  385.     IconCacheRef                        = Handle;
  386. {  IconRefs are 32-bit values identifying cached icon data. IconRef 0 is invalid. }
  387.     IconRef = ^LONGINT;
  388. FUNCTION PlotIconID({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theResID: SInt16): OSErr;
  389.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  390.     INLINE $303C, $0500, $ABC9;
  391.     {$ENDC}
  392. FUNCTION NewIconSuite(VAR theIconSuite: IconSuiteRef): OSErr;
  393.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  394.     INLINE $303C, $0207, $ABC9;
  395.     {$ENDC}
  396. FUNCTION AddIconToSuite(theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr;
  397.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  398.     INLINE $303C, $0608, $ABC9;
  399.     {$ENDC}
  400. FUNCTION GetIconFromSuite(VAR theIconData: Handle; theSuite: IconSuiteRef; theType: ResType): OSErr;
  401.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  402.     INLINE $303C, $0609, $ABC9;
  403.     {$ENDC}
  404. FUNCTION ForEachIconDo(theSuite: IconSuiteRef; selector: IconSelectorValue; action: IconActionUPP; yourDataPtr: UNIV Ptr): OSErr;
  405.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  406.     INLINE $303C, $080A, $ABC9;
  407.     {$ENDC}
  408. FUNCTION GetIconSuite(VAR theIconSuite: IconSuiteRef; theResID: SInt16; selector: IconSelectorValue): OSErr;
  409.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  410.     INLINE $303C, $0501, $ABC9;
  411.     {$ENDC}
  412. FUNCTION DisposeIconSuite(theIconSuite: IconSuiteRef; disposeData: BOOLEAN): OSErr;
  413.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  414.     INLINE $303C, $0302, $ABC9;
  415.     {$ENDC}
  416. FUNCTION PlotIconSuite({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconSuite: IconSuiteRef): OSErr;
  417.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  418.     INLINE $303C, $0603, $ABC9;
  419.     {$ENDC}
  420. FUNCTION MakeIconCache(VAR theCache: IconCacheRef; makeIcon: IconGetterUPP; yourDataPtr: UNIV Ptr): OSErr;
  421.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  422.     INLINE $303C, $0604, $ABC9;
  423.     {$ENDC}
  424. FUNCTION LoadIconCache({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconCache: IconCacheRef): OSErr;
  425.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  426.     INLINE $303C, $0606, $ABC9;
  427.     {$ENDC}
  428. FUNCTION PlotIconMethod({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): OSErr;
  429.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  430.     INLINE $303C, $0805, $ABC9;
  431.     {$ENDC}
  432. FUNCTION GetLabel(labelNumber: SInt16; VAR labelColor: RGBColor; VAR labelString: Str255): OSErr;
  433.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  434.     INLINE $303C, $050B, $ABC9;
  435.     {$ENDC}
  436. FUNCTION PtInIconID(testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconID: SInt16): BOOLEAN;
  437.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  438.     INLINE $303C, $060D, $ABC9;
  439.     {$ENDC}
  440. FUNCTION PtInIconSuite(testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): BOOLEAN;
  441.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  442.     INLINE $303C, $070E, $ABC9;
  443.     {$ENDC}
  444. FUNCTION PtInIconMethod(testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): BOOLEAN;
  445.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  446.     INLINE $303C, $090F, $ABC9;
  447.     {$ENDC}
  448. FUNCTION RectInIconID({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconID: SInt16): BOOLEAN;
  449.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  450.     INLINE $303C, $0610, $ABC9;
  451.     {$ENDC}
  452. FUNCTION RectInIconSuite({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): BOOLEAN;
  453.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  454.     INLINE $303C, $0711, $ABC9;
  455.     {$ENDC}
  456. FUNCTION RectInIconMethod({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): BOOLEAN;
  457.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  458.     INLINE $303C, $0912, $ABC9;
  459.     {$ENDC}
  460. FUNCTION IconIDToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconID: SInt16): OSErr;
  461.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  462.     INLINE $303C, $0613, $ABC9;
  463.     {$ENDC}
  464. FUNCTION IconSuiteToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconSuite: IconSuiteRef): OSErr;
  465.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  466.     INLINE $303C, $0714, $ABC9;
  467.     {$ENDC}
  468. FUNCTION IconMethodToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theMethod: IconGetterUPP; yourDataPtr: UNIV Ptr): OSErr;
  469.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  470.     INLINE $303C, $0915, $ABC9;
  471.     {$ENDC}
  472. FUNCTION SetSuiteLabel(theSuite: IconSuiteRef; theLabel: SInt16): OSErr;
  473.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  474.     INLINE $303C, $0316, $ABC9;
  475.     {$ENDC}
  476. FUNCTION GetSuiteLabel(theSuite: IconSuiteRef): SInt16;
  477.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  478.     INLINE $303C, $0217, $ABC9;
  479.     {$ENDC}
  480. FUNCTION GetIconCacheData(theCache: IconCacheRef; VAR theData: UNIV Ptr): OSErr;
  481.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  482.     INLINE $303C, $0419, $ABC9;
  483.     {$ENDC}
  484. FUNCTION SetIconCacheData(theCache: IconCacheRef; theData: UNIV Ptr): OSErr;
  485.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  486.     INLINE $303C, $041A, $ABC9;
  487.     {$ENDC}
  488. FUNCTION GetIconCacheProc(theCache: IconCacheRef; VAR theProc: IconGetterUPP): OSErr;
  489.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  490.     INLINE $303C, $041B, $ABC9;
  491.     {$ENDC}
  492. FUNCTION SetIconCacheProc(theCache: IconCacheRef; theProc: IconGetterUPP): OSErr;
  493.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  494.     INLINE $303C, $041C, $ABC9;
  495.     {$ENDC}
  496. FUNCTION PlotIconHandle({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIcon: Handle): OSErr;
  497.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  498.     INLINE $303C, $061D, $ABC9;
  499.     {$ENDC}
  500. FUNCTION PlotSICNHandle({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theSICN: Handle): OSErr;
  501.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  502.     INLINE $303C, $061E, $ABC9;
  503.     {$ENDC}
  504. FUNCTION PlotCIconHandle({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theCIcon: CIconHandle): OSErr;
  505.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  506.     INLINE $303C, $061F, $ABC9;
  507.     {$ENDC}
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518. {
  519.    IconServices is an efficient mechanism to share icon data amongst multiple 
  520.    clients. It avoids duplication of data; it provides efficient caching, 
  521.    releasing memory when the icon data is no longer needed; it can provide
  522.    the appropriate icon for any filesystem object; it can provide commonly 
  523.    used icons (caution, note, help...); it is Appearance-savvy: the icons
  524.    are switched when appropriate.
  525.    To refer to a cached icon data, IconServices uses IconRef, a 32-bit
  526.    opaque value. IconRefs are reference counted. When there are no more clients 
  527.    for an IconRef, the bitmap memory associated with it is marked as disposeable. 
  528.    Two files of same type and creator with no custom icon will have the same IconRef.
  529.    Files with custom icons will have their own IconRef.
  530. }
  531.  
  532. {
  533.    Use the special creator kSystemIconsCreator to get "standard" icons 
  534.    that are not associated with a file, such as the help icon.
  535. }
  536.  
  537. CONST
  538.     kSystemIconsCreator            = 'macs';
  539.  
  540.  
  541. {
  542.    Type of the predefined/generic icons. For example, the call:
  543.    GetIconRef(kOnSystemDisk, kSystemIconsCreator, kHelpIcon, &iconRef);
  544.    will retun in iconRef the IconRef for the standard help icon.
  545. }
  546.  
  547. { Generic Finder icons }
  548.     kClipboardIcon                = 'CLIP';
  549.     kClippingUnknownTypeIcon    = 'clpu';
  550.     kClippingPictureTypeIcon    = 'clpp';
  551.     kClippingTextTypeIcon        = 'clpt';
  552.     kClippingSoundTypeIcon        = 'clps';
  553.     kDesktopIcon                = 'desk';
  554.     kFinderIcon                    = 'FNDR';
  555.     kFontSuitcaseIcon            = 'FFIL';
  556.     kFullTrashIcon                = 'ftrh';
  557.     kGenericApplicationIcon        = 'APPL';
  558.     kGenericCDROMIcon            = 'cddr';
  559.     kGenericControlPanelIcon    = 'APPC';
  560.     kGenericControlStripModuleIcon = 'sdev';
  561.     kGenericComponentIcon        = 'thng';
  562.     kGenericDeskAccessoryIcon    = 'APPD';
  563.     kGenericDocumentIcon        = 'docu';
  564.     kGenericEditionFileIcon        = 'edtf';
  565.     kGenericExtensionIcon        = 'INIT';
  566.     kGenericFileServerIcon        = 'srvr';
  567.     kGenericFontIcon            = 'ffil';
  568.     kGenericFontScalerIcon        = 'sclr';
  569.     kGenericFloppyIcon            = 'flpy';
  570.     kGenericHardDiskIcon        = 'hdsk';
  571.     kGenericRemovableMediaIcon    = 'rmov';
  572.     kGenericMoverObjectIcon        = 'movr';
  573.     kGenericPCCardIcon            = 'pcmc';
  574.     kGenericPreferencesIcon        = 'pref';
  575.     kGenericQueryDocumentIcon    = 'qery';
  576.     kGenericRAMDiskIcon            = 'ramd';
  577.     kGenericSharedLibaryIcon    = 'shlb';
  578.     kGenericStationeryIcon        = 'sdoc';
  579.     kGenericSuitcaseIcon        = 'suit';
  580.     kGenericWORMIcon            = 'worm';
  581.     kInternationResourcesIcon    = 'ifil';
  582.     kKeyboardLayoutIcon            = 'kfil';
  583.     kSoundFileIcon                = 'sfil';
  584.     kSystemSuitcaseIcon            = 'zsys';
  585.     kTrashIcon                    = 'trsh';
  586.     kTrueTypeFontIcon            = 'tfil';
  587.     kTrueTypeFlatFontIcon        = 'sfnt';
  588.     kTrueTypeMultiFlatFontIcon    = 'ttcf';
  589.  
  590. { Internet locations }
  591.     kInternetLocationHTTPIcon    = 'ilht';
  592.     kInternetLocationFTPIcon    = 'ilft';
  593.     kInternetLocationAppleShareIcon = 'ilaf';
  594.     kInternetLocationAppleTalkZoneIcon = 'ilat';
  595.     kInternetLocationFileIcon    = 'ilfi';
  596.     kInternetLocationMailIcon    = 'ilma';
  597.     kInternetLocationNewsIcon    = 'ilnw';
  598.     kInternetLocationGenericIcon = 'ilge';
  599.  
  600. { Folders }
  601.     kGenericFolderIcon            = 'fldr';
  602.     kDropFolderIcon                = 'dbox';
  603.     kMountedFolderIcon            = 'mntd';
  604.     kOpenFolderIcon                = 'ofld';
  605.     kOwnedFolderIcon            = 'ownd';
  606.     kPrivateFolderIcon            = 'prvf';
  607.     kSharedFolderIcon            = 'shfl';
  608.  
  609. { Sharing Privileges icons }
  610.     kSharingPrivsNotApplicableIcon = 'shna';
  611.     kSharingPrivsReadOnlyIcon    = 'shro';
  612.     kSharingPrivsReadWriteIcon    = 'shrw';
  613.     kSharingPrivsUnknownIcon    = 'shuk';
  614.     kSharingPrivsWritableIcon    = 'writ';
  615.  
  616.  
  617. { Users and Groups icons }
  618.     kUserFolderIcon                = 'ufld';
  619.     kWorkgroupFolderIcon        = 'wfld';
  620.     kGuestUserIcon                = 'gusr';
  621.     kUserIcon                    = 'user';
  622.     kOwnerIcon                    = 'susr';
  623.     kGroupIcon                    = 'grup';
  624.  
  625. { Special folders }
  626.     kAppleExtrasFolderIcon        = 'aexƒ';
  627.     kAppleMenuFolderIcon        = 'amnu';
  628.     kApplicationsFolderIcon        = 'apps';
  629.     kApplicationSupportFolderIcon = 'asup';
  630.     kAssistantsFolderIcon        = 'astƒ';
  631.     kContextualMenuItemsFolderIcon = 'cmnu';
  632.     kControlPanelDisabledFolderIcon = 'ctrD';
  633.     kControlPanelFolderIcon        = 'ctrl';
  634.     kControlStripModulesFolderIcon = 'sdvƒ';
  635.     kDocumentsFolderIcon        = 'docs';
  636.     kExtensionsDisabledFolderIcon = 'extD';
  637.     kExtensionsFolderIcon        = 'extn';
  638.     kFavoritesFolderIcon        = 'favs';
  639.     kFontsFolderIcon            = 'font';
  640.     kHelpFolderIcon                = 'ƒhlp';
  641.     kInternetFolderIcon            = 'intƒ';
  642.     kInternetPlugInFolderIcon    = 'ƒnet';
  643.     kMacOSReadMeFolderIcon        = 'morƒ';
  644.     kPreferencesFolderIcon        = 'prfƒ';
  645.     kPrinterDescriptionFolderIcon = 'ppdf';
  646.     kPrinterDriverFolderIcon    = 'ƒprd';
  647.     kPrintMonitorFolderIcon        = 'prnt';
  648.     kRecentApplicationsFolderIcon = 'rapp';
  649.     kRecentDocumentsFolderIcon    = 'rdoc';
  650.     kRecentServersFolderIcon    = 'rsrv';
  651.     kScriptingAdditionsFolderIcon = 'ƒscr';
  652.     kSharedLibrariesFolderIcon    = 'ƒlib';
  653.     kScriptsFolderIcon            = 'scrƒ';
  654.     kShutdownItemsDisabledFolderIcon = 'shdD';
  655.     kShutdownItemsFolderIcon    = 'shdf';
  656.     kSpeakableItemsFolder        = 'spki';
  657.     kStartupItemsDisabledFolderIcon = 'strD';
  658.     kStartupItemsFolderIcon        = 'strt';
  659.     kSystemExtensionDisabledFolderIcon = 'macD';
  660.     kSystemFolderIcon            = 'macs';
  661.     kTextEncodingsFolderIcon    = 'ƒtex';
  662.     kAppearanceFolderIcon        = 'appr';
  663.     kUtilitiesFolderIcon        = 'utiƒ';
  664.     kVoicesFolderIcon            = 'fvoc';
  665.     kColorSyncFolderIcon        = 'prof';
  666.     kInternetSearchSitesFolderIcon = 'issf';
  667.  
  668. { Badges }
  669.     kAppleScriptBadgeIcon        = 'scrp';
  670.     kLockedBadgeIcon            = 'lbdg';
  671.     kMountedBadgeIcon            = 'mbdg';
  672.     kSharedBadgeIcon            = 'sbdg';
  673.     kAliasBadgeIcon                = 'abdg';
  674.  
  675. { Alert icons }
  676.     kAlertNoteIcon                = 'note';
  677.     kAlertCautionIcon            = 'caut';
  678.     kAlertStopIcon                = 'stop';
  679.  
  680. { Networking icons }
  681.     kAppleTalkIcon                = 'atlk';
  682.     kAppleTalkZoneIcon            = 'atzn';
  683.     kAFPServerIcon                = 'afps';
  684.     kFTPServerIcon                = 'ftps';
  685.     kIPFileServerIcon            = 'isrv';
  686.  
  687. { Other icons }
  688.     kAppleLogoIcon                = 'capl';
  689.     kAppleMenuIcon                = 'sapl';
  690.     kBackwardArrowIcon            = 'baro';
  691.     kFavoriteItemsIcon            = 'favr';
  692.     kForwardArrowIcon            = 'faro';
  693.     kGridIcon                    = 'grid';
  694.     kHelpIcon                    = 'help';
  695.     kKeepArrangedIcon            = 'arng';
  696.     kLockedIcon                    = 'lock';
  697.     kNoFilesIcon                = 'nfil';
  698.     kNoFolderIcon                = 'nfld';
  699.     kNoWriteIcon                = 'nwrt';
  700.     kProtectedApplicationFolderIcon = 'papp';
  701.     kProtectedSystemFolderIcon    = 'psys';
  702.     kRecentItemsIcon            = 'rcnt';
  703.     kShortcutIcon                = 'shrt';
  704.     kSortAscendingIcon            = 'asnd';
  705.     kSortDescendingIcon            = 'dsnd';
  706.     kUnlockedIcon                = 'ulck';
  707.     kConnectToIcon                = 'cnct';
  708.  
  709.  
  710. {    Error codes range from -2580 to -2599 }
  711.     invalidIconRefErr            = -2580;
  712.     noSuchIconErr                = -2581;
  713.     noIconDataAvailableErr        = -2582;
  714.  
  715.  
  716. {    IconServicesUsageFlags }
  717.  
  718. TYPE
  719.     IconServicesUsageFlags                = UInt32;
  720.  
  721. CONST
  722.     kIconServicesNormalUsageFlag = 0;
  723.  
  724.  
  725. {
  726.       IconFamily 'icns' resources contain an entire IconFamily (all sizes and depths).  
  727.    For custom icons, icns IconFamily resources of the custom icon resource ID are fetched first before
  728.    the classic custom icons (individual 'ics#, ICN#, etc) are fetched.  If the fetch of the icns resource
  729.    succeeds then the icns is looked at exclusively for the icon data.
  730.    For custom icons, new icon features such as 32-bit deep icons are only fetched from the icns resource.
  731.    This is to avoid incompatibilities with cut & paste of new style icons with an older version of the
  732.    MacOS Finder.
  733.    DriverGestalt is called with code kdgMediaIconSuite by IconServices after calling FSM to determine a
  734.    driver icon for a particular device.  The result of the kdgMediaIconSuite call to DriverGestalt should
  735.    be a pointer an an IconFamily.  In this manner driver vendors can provide rich, detailed drive icons
  736.    instead of the 1-bit variety previously supported.
  737. }
  738.     kIconFamilyType                = 'icns';
  739.  
  740.  
  741.  
  742. TYPE
  743.     IconFamilyElementPtr = ^IconFamilyElement;
  744.     IconFamilyElement = RECORD
  745.         elementType:            OSType;                                    {  'ICN#', 'icl8', etc... }
  746.         elementSize:            Size;                                    {  Size of this element }
  747.         elementData:            SInt8;
  748.     END;
  749.  
  750.     IconFamilyResourcePtr = ^IconFamilyResource;
  751.     IconFamilyResource = RECORD
  752.         resourceType:            OSType;                                    {  Always 'icns' }
  753.         resourceSize:            Size;                                    {  Total size of this resource }
  754.         elements:                ARRAY [0..0] OF IconFamilyElement;
  755.     END;
  756.  
  757.     IconFamilyPtr                        = ^IconFamilyResource;
  758.     IconFamilyHandle                    = ^IconFamilyPtr;
  759.  
  760. {
  761.   ==============================================================================
  762.    Initialization and Termination
  763.   ==============================================================================
  764. }
  765.  
  766.  
  767. {
  768.    IconServicesInit
  769.    
  770.    Call this routine once per classic 68K application initialization.
  771.    This routine does not need to be called at boot time.
  772. }
  773.  
  774. FUNCTION IconServicesInit(initBlockPtr: CFragInitBlockPtr): OSErr;
  775.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  776.     INLINE $7015, $AA75;
  777.     {$ENDC}
  778.  
  779. {
  780.    IconServicesTerminate:
  781.    
  782.    Call this routine once from the termination of a classic 68K application.
  783.    This routine does not need to be called at boot time.
  784. }
  785.  
  786. PROCEDURE IconServicesTerminate;
  787.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  788.     INLINE $7016, $AA75;
  789.     {$ENDC}
  790.  
  791.  
  792. {
  793.   ==============================================================================
  794.    Converting data structures
  795.   ==============================================================================
  796. }
  797.  
  798.  
  799. {
  800.    IconRefToIconFamily
  801.    This routines returns a new IconFamily that contains the data corresponding
  802.    to the specified IconRef
  803. }
  804.  
  805. FUNCTION IconRefToIconFamily(theIconRef: IconRef; whichIcons: IconSelectorValue; VAR iconFamily: IconFamilyHandle): OSErr;
  806.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  807.     INLINE $7024, $AA75;
  808.     {$ENDC}
  809.  
  810. {
  811.    IconFamilyToIconSuite
  812.    This routines transfers the data in an icon family into an icon suite.
  813. }
  814.  
  815. FUNCTION IconFamilyToIconSuite(iconFamily: IconFamilyHandle; whichIcons: IconSelectorValue; VAR iconSuite: IconSuiteRef): OSErr;
  816.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  817.     INLINE $7025, $AA75;
  818.     {$ENDC}
  819.  
  820. {
  821.    IconSuiteToIconFamily
  822.    This routines transfers the data in an icon suite into an icon family.
  823. }
  824.  
  825. FUNCTION IconSuiteToIconFamily(iconSuite: IconSuiteRef; whichIcons: IconSelectorValue; VAR iconFamily: IconFamilyHandle): OSErr;
  826.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  827.     INLINE $7026, $AA75;
  828.     {$ENDC}
  829.  
  830. {
  831.    SetIconFamilyData
  832.    Change the data of an icon family. The data is copied.
  833.    The type can be one of the icon type, or 'PICT'
  834.    The data will be compressed if needed.
  835. }
  836.  
  837. FUNCTION SetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr;
  838.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  839.     INLINE $7030, $AA75;
  840.     {$ENDC}
  841.  
  842. {
  843.    GetIconFamilyData
  844.    Return a copy of the data in the icon family.
  845.    The type can be one of the icon type, or 'PICT'
  846.    The data will be returned uncompressed.
  847. }
  848.  
  849. FUNCTION GetIconFamilyData(iconFamily: IconFamilyHandle; iconType: OSType; h: Handle): OSErr;
  850.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  851.     INLINE $7031, $AA75;
  852.     {$ENDC}
  853.  
  854. {
  855.   ==============================================================================
  856.    Reference counting
  857.   ==============================================================================
  858. }
  859.  
  860.  
  861. {
  862.    GetIconRefOwners
  863.    
  864.    This routine returns the reference count for the IconRef, or number of owners.
  865.    
  866.    A valid IconRef always has at least one owner.
  867. }
  868.  
  869. FUNCTION GetIconRefOwners(theIconRef: IconRef; VAR owners: UInt16): OSErr;
  870.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  871.     INLINE $700B, $AA75;
  872.     {$ENDC}
  873.  
  874. {
  875.    AcquireIconRef
  876.    This routine increments the reference count for the IconRef
  877. }
  878.  
  879. FUNCTION AcquireIconRef(theIconRef: IconRef): OSErr;
  880.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  881.     INLINE $7027, $AA75;
  882.     {$ENDC}
  883.  
  884.  
  885. {
  886.    ReleaseIconRef
  887.    
  888.    This routine decrements the reference count for the IconRef.
  889.    
  890.    When the reference count reaches 0, all memory allocated for the icon
  891.    is disposed. Any subsequent use of the IconRef is invalid.
  892. }
  893.  
  894. FUNCTION ReleaseIconRef(theIconRef: IconRef): OSErr;
  895.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  896.     INLINE $7028, $AA75;
  897.     {$ENDC}
  898.  
  899.  
  900. {
  901.   ==============================================================================
  902.    Getting an IconRef
  903.   ==============================================================================
  904. }
  905.  
  906.  
  907. {
  908.    GetIconRefFromFile
  909.    
  910.    This routine returns an icon ref for the specified file, folder or volume.
  911.    The label information is provided separately, since two files with the same icon 
  912.    but a different label would share the same iconRef. The label can be used in 
  913.    PlotIconRef() for example.
  914.    
  915.    Use this routine if you have no information about the file system object. If 
  916.    you have already done a GetCatInfo on the file and want to save some I/O, 
  917.    call GetIconRefFromFolder() if you know it's a folder with no custom icon or 
  918.    call GetIconRef() if it's a file with no custom icon.
  919.    This routine increments the reference count of the returned IconRef. Call 
  920.    ReleaseIconRef() when you're done with it.
  921. }
  922.  
  923. FUNCTION GetIconRefFromFile({CONST}VAR theFile: FSSpec; VAR theIconRef: IconRef; VAR theLabel: SInt16): OSErr;
  924.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  925.     INLINE $7002, $AA75;
  926.     {$ENDC}
  927.  
  928. {
  929.    GetBaseIconRefFromFile
  930.    
  931.    This routine returns the base icon ref for a file, that is, the icon 
  932.    without any badge applied to it. In most cases, you should call 
  933.    GetIconRefFromFile.
  934. }
  935. FUNCTION GetBaseIconRefFromFile({CONST}VAR theFile: FSSpec; VAR theIconRef: IconRef; VAR theLabel: SInt16): OSErr;
  936.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  937.     INLINE $702E, $AA75;
  938.     {$ENDC}
  939.  
  940. {
  941.    GetIconRef
  942.    
  943.    This routine returns an icon ref for an icon in the desktop database or
  944.    for a registered icon.
  945.    The system registers a set of icon such as the help icon with the creator 
  946.    code kSystemIconCreator. See above for a list of the registered system types.
  947.    The vRefNum is used as a hint on where to look for the icon first. Use 
  948.    kOnSystemDisk if you don't know what to pass.
  949.    This routine increments the reference count of the returned IconRef. Call 
  950.    ReleaseIconRef() when you're done with it.
  951. }
  952.  
  953. FUNCTION GetIconRef(vRefNum: SInt16; creator: OSType; iconType: OSType; VAR theIconRef: IconRef): OSErr;
  954.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  955.     INLINE $7021, $AA75;
  956.     {$ENDC}
  957.  
  958.  
  959. {
  960.    GetIconRefFromFolder
  961.    
  962.    This routine returns an icon ref for a folder with no custom icon.
  963.    Use the more generic, but slightly slower, GetIconRefFromFile() if
  964.    you don't already have the necessary info about the file.
  965.    Attributes should be CInfoPBRec.dirInfo.ioFlAttrib for this folder.
  966.    Access privileges should be CInfoPBRec.dirInfo.ioACUser for this folder.
  967.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  968.    when you're done with it.
  969. }
  970.  
  971. FUNCTION GetIconRefFromFolder(vRefNum: SInt16; parentFolderID: SInt32; folderID: SInt32; attributes: SInt8; accessPrivileges: SInt8; VAR theIconRef: IconRef): OSErr;
  972.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  973.     INLINE $7022, $AA75;
  974.     {$ENDC}
  975.  
  976.  
  977. {
  978.   ==============================================================================
  979.    Adding and modifying IconRef
  980.   ==============================================================================
  981. }
  982.  
  983.  
  984. {
  985.    RegisterIconRefFromIconFamily
  986.    This routine adds a new entry to the IconRef registry. Other clients will be 
  987.    able to access it using the (creator, iconType) pair specified here.
  988.    Lower-case creators are reserved for the system.
  989.    Consider using RegisterIconRefFromResource() if possible, since the data 
  990.    registered using RegisterIconRefFromFamily() cannot be purged.
  991.    The iconFamily data is copied and the caller is reponsible for disposing of it.
  992.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  993.    when you're done with it.
  994. }
  995.  
  996. FUNCTION RegisterIconRefFromIconFamily(creator: OSType; iconType: OSType; iconFamily: IconFamilyHandle; VAR theIconRef: IconRef): OSErr;
  997.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  998.     INLINE $701C, $AA75;
  999.     {$ENDC}
  1000.  
  1001. {
  1002.    RegisterIconRefFromResource
  1003.    
  1004.    Registers an IconRef from a resouce file.  
  1005.    The icon data to be fetched is either classic icon data or an icon family.  
  1006.    The 'icns' icon family is searched for before the classic icon data.
  1007.    This routine increments the reference count of the IconRef. Call ReleaseIconRef() 
  1008.    when you're done with it.
  1009. }
  1010.  
  1011. FUNCTION RegisterIconRefFromResource(creator: OSType; iconType: OSType; {CONST}VAR resourceFile: FSSpec; resourceID: SInt16; VAR theIconRef: IconRef): OSErr;
  1012.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1013.     INLINE $7023, $AA75;
  1014.     {$ENDC}
  1015.  
  1016. {
  1017.    UnregisterIconRef
  1018.    
  1019.    Removes the specified icon from the icon cache (if there are no users of it).  
  1020.    If some clients are using this iconRef, then the IconRef will be removed when the 
  1021.    last user calls ReleaseIconRef.
  1022. }
  1023.  
  1024. FUNCTION UnregisterIconRef(creator: OSType; iconType: OSType): OSErr;
  1025.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1026.     INLINE $7008, $AA75;
  1027.     {$ENDC}
  1028.  
  1029.  
  1030. {
  1031.    UpdateIconRef
  1032.    
  1033.    Call this routine to force an update of the data for iconRef.
  1034.    
  1035.    For example after changing an icon in the desktop database or changing the custom 
  1036.    icon of a file. Note that after _adding_ a custom icon to file or folder, you 
  1037.    need to call GetIconRefFromFile() to get a new IconRef specific to this file. 
  1038.    
  1039.    This routine does nothing if the IconRef is a registered icon.
  1040. }
  1041.  
  1042. FUNCTION UpdateIconRef(theIconRef: IconRef): OSErr;
  1043.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1044.     INLINE $7009, $AA75;
  1045.     {$ENDC}
  1046.  
  1047.  
  1048. {
  1049.    OverrideIconRefFromResource
  1050.    
  1051.    This routines replaces the bitmaps of the specified IconRef with the ones
  1052.    in the specified resource file.
  1053. }
  1054.  
  1055. FUNCTION OverrideIconRefFromResource(theIconRef: IconRef; {CONST}VAR resourceFile: FSSpec; resourceID: SInt16): OSErr;
  1056.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1057.     INLINE $702A, $AA75;
  1058.     {$ENDC}
  1059.  
  1060.  
  1061. {
  1062.    OverrideIconRef
  1063.    
  1064.    This routines replaces the bitmaps of the specified IconRef with the ones
  1065.    from the new IconRef.
  1066. }
  1067.  
  1068. FUNCTION OverrideIconRef(oldIconRef: IconRef; newIconRef: IconRef): OSErr;
  1069.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1070.     INLINE $702B, $AA75;
  1071.     {$ENDC}
  1072.  
  1073. {
  1074.    RemoveIconRefOverride
  1075.    This routine remove an override if one was applied to the icon and 
  1076.    reverts back to the original bitmap data.
  1077. }
  1078.  
  1079. FUNCTION RemoveIconRefOverride(theIconRef: IconRef): OSErr;
  1080.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1081.     INLINE $701E, $AA75;
  1082.     {$ENDC}
  1083.  
  1084.  
  1085. {
  1086.   ==============================================================================
  1087.    Creating composite IconRef
  1088.   ==============================================================================
  1089. }
  1090.  
  1091.  
  1092. {
  1093.    CompositeIconRef
  1094.    
  1095.    Superimposes an IconRef on top of another one
  1096. }
  1097.  
  1098. FUNCTION CompositeIconRef(backgroundIconRef: IconRef; foregroundIconRef: IconRef; VAR compositeIconRef: IconRef): OSErr;
  1099.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1100.     INLINE $7014, $AA75;
  1101.     {$ENDC}
  1102.  
  1103. {
  1104.    IsIconRefComposite
  1105.    Indicates if a given icon ref is a composite of two other icon refs (and which ones)
  1106.    If it isn't a composite, backgroundIconRef and foreGroundIconRef will be 0.
  1107. }
  1108.  
  1109. FUNCTION IsIconRefComposite(compositeIconRef: IconRef; VAR backgroundIconRef: IconRef; VAR foregroundIconRef: IconRef): OSErr;
  1110.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1111.     INLINE $701A, $AA75;
  1112.     {$ENDC}
  1113.  
  1114.  
  1115. {
  1116.   ==============================================================================
  1117.    Using IconRef
  1118.   ==============================================================================
  1119. }
  1120.  
  1121. {
  1122.    IsValidIconRef
  1123.    Return true if the iconRef passed in is a valid icon ref
  1124. }
  1125.  
  1126. FUNCTION IsValidIconRef(theIconRef: IconRef): BOOLEAN;
  1127.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1128.     INLINE $700E, $AA75;
  1129.     {$ENDC}
  1130.  
  1131. {
  1132.    PlotIconRef
  1133.    
  1134.    This routine plots the IconRef.  It mostly takes the same parameters as PlotIconSuite.
  1135.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1136. }
  1137.  
  1138. FUNCTION PlotIconRef({CONST}VAR theRect: Rect; align: IconAlignmentType; transform: IconTransformType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr;
  1139.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1140.     INLINE $700E, $AA75;
  1141.     {$ENDC}
  1142.  
  1143. {
  1144.    PtInIconRef
  1145.    
  1146.    This routine indicates if testPt would hit the icon designated by iconRef.
  1147.    It mostly takes the same parameters as PtInIconSuite.
  1148.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1149. }
  1150.  
  1151.  
  1152. FUNCTION PtInIconRef({CONST}VAR testPt: Point; {CONST}VAR iconRect: Rect; align: IconAlignmentType; theIconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): BOOLEAN;
  1153.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1154.     INLINE $700F, $AA75;
  1155.     {$ENDC}
  1156.  
  1157. {
  1158.    RectInIconRef
  1159.    
  1160.    This routine indicates if testRect would intersect the icon designated by iconRef.
  1161.    It mostly takes the same parameters as RectInIconSuite.
  1162.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1163. }
  1164.  
  1165.  
  1166. FUNCTION RectInIconRef({CONST}VAR testRect: Rect; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): BOOLEAN;
  1167.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1168.     INLINE $7010, $AA75;
  1169.     {$ENDC}
  1170.  
  1171. {
  1172.    IconRefToRgn
  1173.    
  1174.    This routine returns a region for the icon.
  1175.    It mostly takes the same parameters as IconSuiteToRgn.
  1176.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1177. }
  1178.  
  1179. FUNCTION IconRefToRgn(theRgn: RgnHandle; {CONST}VAR iconRect: Rect; align: IconAlignmentType; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr;
  1180.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1181.     INLINE $7011, $AA75;
  1182.     {$ENDC}
  1183.  
  1184. {
  1185.    GetIconSizesFromIconRef
  1186.    
  1187.    This routine returns an IconSelectorValue indicating the depths and sizes of 
  1188.    icon data which are actually available.  It takes an IconSelectorValue 
  1189.    indicating which sizes/depths the caller is interested and returns an 
  1190.    IconSelectorValue indicating which sizes/depths exist.
  1191.    
  1192.    Caution:
  1193.    
  1194.    This is potentially an extremely expensive call as IconServices may be forced 
  1195.    to attempt fetching the data for the IconRef's sizes/depths which may result 
  1196.    in hitting the local disk or even the network to obtain the data to determine 
  1197.    which sizes/depths actually exist.
  1198.    Pass kIconServicesNormalUsageFlag as a default value for IconServicesUsageFlags.
  1199. }
  1200.  
  1201. FUNCTION GetIconSizesFromIconRef(iconSelectorInput: IconSelectorValue; VAR iconSelectorOutputPtr: IconSelectorValue; iconServicesUsageFlags: IconServicesUsageFlags; theIconRef: IconRef): OSErr;
  1202.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1203.     INLINE $7012, $AA75;
  1204.     {$ENDC}
  1205.  
  1206.  
  1207. {
  1208.   ==============================================================================
  1209.    Flushing IconRef data
  1210.   ==============================================================================
  1211. }
  1212.  
  1213.  
  1214. {
  1215.    FlushIconRefs
  1216.    
  1217.    Making this call will dispose of all the data for the specified icons if 
  1218.    the data can be reacquired, for example if the data is provided from a resource.
  1219.    '****' is a wildcard for all types or all creators.
  1220. }
  1221.  
  1222. FUNCTION FlushIconRefs(creator: OSType; iconType: OSType): OSErr;
  1223.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1224.     INLINE $7029, $AA75;
  1225.     {$ENDC}
  1226.  
  1227. {
  1228.    FlushIconRefsByVolume
  1229.    
  1230.    This routine disposes of the data for the icons related to the indicated volume
  1231.    if this data can be reacquired, for example if the data is provided from a 
  1232.    resource.
  1233. }
  1234.  
  1235. FUNCTION FlushIconRefsByVolume(vRefNum: SInt16): OSErr;
  1236.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1237.     INLINE $7018, $AA75;
  1238.     {$ENDC}
  1239.  
  1240.  
  1241. {
  1242.   ==============================================================================
  1243.    Controling custom icons
  1244.   ==============================================================================
  1245. }
  1246.  
  1247.  
  1248. {
  1249.    SetCustomIconsEnabled
  1250.    
  1251.    Enable or disable custom icons on the specified volume.
  1252. }
  1253.  
  1254. FUNCTION SetCustomIconsEnabled(vRefNum: SInt16; enableCustomIcons: BOOLEAN): OSErr;
  1255.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1256.     INLINE $701F, $AA75;
  1257.     {$ENDC}
  1258.  
  1259. {
  1260.    GetCustomIconsEnabled
  1261.    
  1262.    Return true if custom icons are enabled on the specified volume, false otherwise.
  1263. }
  1264.  
  1265. FUNCTION GetCustomIconsEnabled(vRefNum: SInt16; VAR customIconsEnabled: BOOLEAN): OSErr;
  1266.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1267.     INLINE $7020, $AA75;
  1268.     {$ENDC}
  1269.  
  1270. {
  1271.    SetCustomIconFamily
  1272.    Sets the custom icon of a file or folder.
  1273.    AliasIcon should be true to indicate you want to specify the 
  1274.    appearance that the alias file should have. You can further
  1275.    override the appearance of the alias by specifying a custom 
  1276.    icon.
  1277. }
  1278. FUNCTION SetCustomIconFamily({CONST}VAR theFile: FSSpec; aliasIcon: BOOLEAN; customIcon: IconRef): OSErr;
  1279.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1280.     INLINE $702F, $AA75;
  1281.     {$ENDC}
  1282.  
  1283. {$ALIGN RESET}
  1284. {$POP}
  1285.  
  1286. {$SETC UsingIncludes := IconsIncludes}
  1287.  
  1288. {$ENDC} {__ICONS__}
  1289.  
  1290. {$IFC NOT UsingIncludes}
  1291.  END.
  1292. {$ENDC}
  1293.